<?php
class User_model{
	public function check_user_password($login_name, $login_password){
		$sql = 'SELECT u_id FROM ytx_user WHERE u_login=:u_login AND u_pass=md5(CONCAT(:u_pass, u_pass_salt))';
		$sth = $this->db->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
		$sth->bindParam(':u_login', $login_name, PDO::PARAM_STR);
		$sth->bindParam(':u_pass',  $login_password, PDO::PARAM_STR);
		$ret = $sth->execute();
		if ($ret === FALSE){
			$arr = $sth->errorInfo();
			//xj_show_info($arr[2]);
			xj_log_message('error', '['.__METHOD__.']'.$arr[2]);
			return FALSE;
		}
		$ret = $sth->fetchAll();
		if (empty($ret)){
			return FALSE;
		}
		return  $ret[0]['u_id'];
	}
}